<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/jsp/common/head.jsp"%>

<div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>电子图书列表 >> 修改页面</span>
        </div>
        <div class="providerAdd">
          <form id="billForm" name="ebookEntry" method="post" action="${pageContext.request.contextPath }/bill/update">
				<%--修改必须通过主键去进行,所以要有一个隐藏域来存储查询到的id值--%>
                <!--div的class 为error是验证错误，ok是验证成功-->
                <div class="">
                    <label for="id">图书编号：</label>
                    <input type="text" name="id" id="id" value="${ebookEntry.id }" readonly="readonly">
                </div>
                <div>
                    <label for="title">图书名称：</label>
                    <input type="text" name="title" id="title" value="${ebookEntry.title }">
					<font color="red"></font>
                </div>
                <div>
                    <label for="summary">图书摘要：</label>
                    <textarea cols="35" rows="5" name="summary" id="summary">${ebookEntry.summary }</textarea>
					<font color="red"></font>
                </div>
                <div>
                    <label for="uploaduser">上传人：</label>
                    <input type="text" name="uploaduser" id="uploaduser" value="${ebookEntry.uploaduser }">
					<font color="red"></font>
                </div>
                <%--<div>
                    <label for="createdate">上传时间：</label>
                    <input type="text" name="createdate" id="createdate" value="${ebookEntry.createdate }">
					<font color="red"></font>
                </div>--%>
                    <div>
                        <label >分类：</label>
                        <select name="categoryId" id="categoryId">
                            <option value="0">==请选择==</option>
                        </select>
                        <font color="red"></font>
                    </div>
                <div class="providerAddBtn">
                  <input type="submit" name="save" id="save" value="提交">
				  <input type="button" id="back" name="back" onclick="history.back()" value="返回" >
              	</div>
            </form>
        </div>

    </div>
</section>

<%@include file="/jsp/common/foot.jsp" %>
<%--
<script type="text/javascript" src="${pageContext.request.contextPath }/js/billmodify.js"></script>--%>
<script>

    //页面加载的时候加载供应商信息
    $.ajax({
        url:"/provider/list",
        success:function (data) {
            //console.log(data);

            //创建一个字符串变量
            var optins = "";

            //遍历数组
            for(var i = 0 ; i < data.length ; i++){
                //把数组中的每一个元素的id和名称拼接到下拉项option标签中
                optins += "<option value='"+data[i].id+"'>"+data[i].name+"</option>";
            }
            //把创建的所有的option标签添加到select表的后面
            $("#categoryId").append(optins);

        }
    })
</script>